//
//  CoreGraphicsTestViewController.h
//  CoreGraphicsTest
//
//  Created by aewatson on 11/7/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "SpriteView.h"
#import "GameModel.h"
#import "BlockImages.h"
#import "SoundPlayer.h"

static const double REFRESH_INTERVAL = 0.01;

@interface CoreGraphicsTestViewController : UIViewController {
    UIView *controlView;
    UIView *graphicsView;
    UIView *pauseView;
    NSTimer *myTimer;
    GameModel *gameModel;
    NSMutableArray *spriteViews;
    NSDate *lastTick;
    UIButton *blueButton;
    UIButton *redButton;
    UIButton *yellowButton;
    UIButton *greenButton;
    UIButton *readyButton;
    UIButton *backButton;
    UIButton *pauseButton;
    UILabel *roundLabel;
    UILabel *scoreLabel;
    UILabel *statusLabel;
    UILabel *summaryLabel;
    BlockImages* blockImages;
    SoundPlayer* soundPlayer;
}

@property (nonatomic, retain) IBOutlet UIView *controlView;
@property (nonatomic, retain) IBOutlet UIView *graphicsView;
@property (nonatomic, retain) IBOutlet UIView *pauseView;
@property (nonatomic, retain) NSTimer *myTimer;
@property (nonatomic, retain) GameModel *gameModel;
@property (nonatomic, retain) NSMutableArray *spriteViews;
@property (nonatomic, retain) BlockImages *blockImages;
@property (nonatomic, retain) IBOutlet UIButton *yellowButton;
@property (nonatomic, retain) IBOutlet UIButton *greenButton;
@property (nonatomic, retain) IBOutlet UIButton *blueButton;
@property (nonatomic, retain) IBOutlet UIButton *redButton;
@property (nonatomic, retain) IBOutlet UIButton *pauseButton;
@property (nonatomic, retain) IBOutlet UIButton *readyButton;
@property (nonatomic, retain) IBOutlet UIButton *backButton;
@property (nonatomic, retain) IBOutlet UILabel *roundLabel;
@property (nonatomic, retain) IBOutlet UILabel *scoreLabel;
@property (nonatomic, retain) IBOutlet UILabel *statusLabel;
@property (nonatomic, retain) IBOutlet UILabel *summaryLabel;
@property (nonatomic, retain) SoundPlayer *soundPlayer;

@property (nonatomic, retain) NSDate *lastTick;

- (NSTimer*)createTimer;
- (void)timerTicked:(NSTimer*)timer;
- (void)actionStop:(id)sender;
- (void)createViewWithModel:(SpriteModel*) spriteModel;
- (void)removeViewWithModel:(SpriteModel*) spriteModel;
- (void)changeViewStateWithModel:(SpriteModel*) spriteModel;
- (void)spriteStateChanged:(NSNotification *)notification;
//- (void)spriteAdded:(NSNotification *)notification;
- (void)spriteRemoved:(NSNotification *)notification;
- (void)blockAdded:(NSNotification *)notification;
- (void)shotAdded:(NSNotification *)notification;
- (void)explosionAdded:(NSNotification *)notification;
- (void)roundEnded:(NSNotification *)notification;
- (void)scoreChanged:(NSNotification *)notification;
- (void)updateView;
- (void)startTimer;
- (void)resumeTimer;

- (IBAction)redButtonPressed;
- (IBAction)greenButtonPressed;
- (IBAction)blueButtonPressed;
- (IBAction)yellowButtonPressed;
- (IBAction)readyButtonPressed;
- (IBAction)pauseButtonPressed;
- (IBAction)backButtonPressed;

@end
